package com.zlfund.cat.zjgsmk.util;

import android.support.v4.view.ViewPager;
import android.view.View;

/**
 * Created by chenj
 * Created on 2017/8/18
 */

public class ScaleTransformer implements ViewPager.PageTransformer {
    @Override
    public void transformPage(View page, float position) {
        if (position <= -1) {
            page.setScaleX(0.8f);
            page.setScaleY(0.8f);
        } else if (position <= 0) {
            page.setScaleX(1f + position * 0.2f);
            page.setScaleY(1f + position * 0.2f);
        } else if (position < 1) {
            page.setScaleX(1f - position * 0.2f);
            page.setScaleY(1f - position * 0.2f);
        } else {
            page.setScaleX(0.8f);
            page.setScaleY(0.8f);
        }
    }
}
